import { get, post } from '@/utils/request';

const api = {
   login: '/mock/dev/login',
   userInfo: '/mock/dev/userInfo',
};

// 登录
export const login = (params) => {
   return post(api.login, params);
};

// 获取用户信息
export const getUserInfo = (params) => {
   const token = localStorage.getItem('token');
   if (!token) return Promise.reject(new Error('用户未登录'));
   return get(api.userInfo, params);
};

export default { login, getUserInfo };
